//
//  NewsWordViewController.m
//  WXMovie
//
//  Created by HZApple on 16/4/1.
//  Copyright © 2016年 无限互联. All rights reserved.
//

#import "NewsWordViewController.h"

@interface NewsWordViewController ()

@property (nonatomic, strong) UIActivityIndicatorView *indictor;

@end

@implementation NewsWordViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"文字新闻";
    //self.webView.delegate = self;
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.baidu.com"]]];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

//- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;
- (void)webViewDidStartLoad:(UIWebView *)webView {
    
    _indictor = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    
    _indictor.frame = CGRectMake(kScreenWidth / 2, kScreenHeight / 2, 100, 100);
    [self.view insertSubview:_indictor aboveSubview:_webView];
    [_indictor startAnimating];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
    [_indictor stopAnimating];
    
}
//- (void)webView:(UIWebView *)webView didFailLoadWithError:(nullable NSError *)error;

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
